﻿@page "/table"
@inject IStringLocalizer<NavMenu> NavMenuLocalizer
@inject IStringLocalizer<Tables> Localizer
@inject IStringLocalizer<Foo> FooLocalizer

<h3>@Localizer["TableBaseTitle"] - @NavMenuLocalizer["TableBase"]</h3>
<h4>@Localizer["TableBaseDescription"]</h4>

<Tips>
    <p>@((MarkupString)Localizer["TableBaseExplain1"].Value)</p>
    <p>@((MarkupString)Localizer["TableBaseExplain2"].Value)</p>
    <ul class="ul-demo">
        <li>@((MarkupString)Localizer["TableBaseTips1"].Value)</li>
        <li>@((MarkupString)Localizer["TableBaseTips2"].Value)</li>
        <li>@((MarkupString)Localizer["TableBaseTips3"].Value)</li>
    </ul>
    <p>@((MarkupString)Localizer["TableBaseTips4"].Value)</p>
</Tips>

<DemoBlock Title="@Localizer["TableBaseNormalTitle"]"
           Introduction="@Localizer["TableBaseNormalIntro"]"
           Name="Normal">
    <section ignore>
        <p>@((MarkupString)Localizer["TableBaseNormalDescription"].Value)</p>
        <Button Icon="fa-solid fa-arrows-rotate" Text="@RefreshText" OnClick="OnClick" />
    </section>
    <Table TItem="Foo" Items="@Items.Take(3)">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" />
            <TableColumn @bind-Field="@context.Name" />
            <TableColumn @bind-Field="@context.Address" />
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@Localizer["TableBaseStripedTitle"]"
           Introduction="@Localizer["TableBaseStripedIntro"]"
           Name="IsStriped">
    <Table TItem="Foo" Items="@Items.Take(3)" IsStriped="true">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" />
            <TableColumn @bind-Field="@context.Name" />
            <TableColumn @bind-Field="@context.Address" />
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@Localizer["TableBaseBorderedTitle"]"
           Introduction="@Localizer["TableBaseBorderedIntro"]"
           Name="IsBordered">
    <Table TItem="Foo" Items="@Items.Take(3)" IsBordered="true">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" />
            <TableColumn @bind-Field="@context.Name" />
            <TableColumn @bind-Field="@context.Address" />
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@Localizer["TableBaseSizeTitle"]"
           Introduction="@Localizer["TableBaseSizeIntro"]"
           Name="TableSize">
    <section ignore>@((MarkupString)Localizer["TableBaseSizeDescription"].Value)</section>
    <Table TItem="Foo" Items="@Items.Take(3)" IsBordered="true" IsStriped="true" TableSize="TableSize.Compact">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" Filterable="true" Sortable="true" />
            <TableColumn @bind-Field="@context.Name" Filterable="true" />
            <TableColumn @bind-Field="@context.Address" Sortable="true" />
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@Localizer["TableBaseHeaderStyleTitle"]"
           Introduction="@Localizer["TableBaseHeaderStyleIntro"]"
           Name="HeaderStyle">
    <section ignore>
        <p>@((MarkupString)Localizer["TableBaseHeaderStyleDescription"].Value)</p>
        <div class="code-label mb-3"><code>Light</code> @Localizer["TableBaseHeaderStyleMode"]</div>
    </section>
    <Table TItem="Foo" Items="@Items.Take(3)" HeaderStyle="TableHeaderStyle.Light" IsBordered="true">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" />
            <TableColumn @bind-Field="@context.Name" />
            <TableColumn @bind-Field="@context.Address" />
        </TableColumns>
    </Table>

    <section ignore class="code-label my-3"><code>Dark</code> @Localizer["TableBaseHeaderStyleMode"]</section>
    <Table TItem="Foo" Items="@Items.Take(3)" HeaderStyle="TableHeaderStyle.Dark" IsBordered="true">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" />
            <TableColumn @bind-Field="@context.Name" />
            <TableColumn @bind-Field="@context.Address" />
        </TableColumns>
    </Table>
</DemoBlock>

<AttributeTable Items="GetAttributes()" />

<MethodTable Items="GetMethods()" />

<AttributeTable Items="GetTableColumnAttributes()" Title="@Localizer["AttributeTitle"]" />
